#include <iostream>
#include <stdexcept>  // 包含标准异常类

int divide(int a, int b) {
    if (b == 0) {
        throw std::runtime_error("除数不能为零");  // 抛出异常
    }
    return a / b;
}

int main() {
    int x = 10;
    int y = 0;
    try {
        int result = divide(x, y);
        std::cout << "结果是: " << result << std::endl;
    } catch (const std::runtime_error& e) {
        std::cout << "发生异常: " << e.what() << std::endl;
    }
    return 0;
}